import { request } from "@/utils/requst"
import { login } from "@/utils/util"

Page({
    onShow(){
        // login()
    },
    data: {
        readingShow: false,
        mailInfo: {
        "content": "1111",
        "emailAddress": "",
        "sendDate": "",
        "isPublic": true,
        "name": "张三",
        "createTime": "",
        "updateTime": ""
        },
    },
    writeMail(){
        wx.navigateTo({url: '../write/write'})
    },
    async randomReading() {
        const result:any = await request('GET', '/sendMail')
        if (!result.data.data.name) {
            wx.showToast({
                title: '暂无公开信、请稍后查看',
                icon: 'none'
            })
            return
        }
        this.setData({
            readingShow: true,
            mailInfo: result.data.data
        })
    },
})